package util;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class GetUrl {
	
	public static String GetUrlByJson(String json) {
		String str = json;
     //   System.out.println(str);
      //  System.out.println();
        String regEx = "<img [^>]*src=['\"]([^'\"]+)[^>]*>";
    //    System.out.println(regEx);
        Pattern pattern = Pattern.compile(regEx);
        Matcher matcher = pattern.matcher(str);
        String url = "";
        while(matcher.find())
        {
            url = matcher.group();
            break;
        }
		return url;
	}
	public static void main(String args[]) {
		String str = "<p><img title=\"1556905739241071915.jpg\" alt=\"4.jpg\" src=\"/Tourism/ueditor/jsp/upload/image/20190504/1556905739241071915.jpg\"/></p>11111111111111111111111<img title=\"1556905772995023188.jpg\" alt=\"4.jpg\" src=\"/Tourism/ueditor/jsp/upload/image/20190504/1556905772995023188.jpg\"/>";
	       String url = GetUrlByJson(str);
	       System.out.println(url);
	       String[] rs = url.split("src");
	       String all = rs[0]+" class=\"full-width img-responsive wow fadeInUp\""+"alt=\"Portfolio Image\" data-wow-duration=\".3\" data-wow-delay=\".3s\""+" src "+rs[1];
	       
	      System.out.println(all);
	}

}
